# Copyright:: Copyright (c) 2008 Howling Moon Software


WIDTH = 800
HEIGHT = 600

AS.open_screen(WIDTH, HEIGHT, :vbl_sync => true)
AS.clear_color(1, 0, 0, 0)
AS.clear_screen
AS.clear_color(0, 0, 0, 0)


class DemoState < AS::GameState::TickLimitedState
	
	def switch_state(state)
		DemoState.new(state).run
	end
	
	def initialize(delegate)
		super(1.0/60.0, delegate)
		@switcher_actions = AS::Event::ActionListener.new
		@switcher_actions.action(AS::Event.source_for_key(:Key_1)){|event| switch_state(DEMO_LIST[0]) unless event.state}
		@switcher_actions.action(AS::Event.source_for_key(:Key_2)){|event| switch_state(DEMO_LIST[1]) unless event.state}
		@switcher_actions.action(AS::Event.source_for_key(:Key_2)){|event| switch_state(DEMO_LIST[2]) unless event.state}
	end

	def input(event)
		@switcher_actions.call(event)
		super(event)
	end

end

require 'textDemo.rb'
require 'eventDemo.rb'
require 'sceneTest.rb'

DEMO_LIST =
[
	TextDemo.new,
	EventDemo.new,
]



DemoState.new(DEMO_LIST[0]).run

